cmake_minimum_required(VERSION 3.2)

set(TARGET_NAME My_Tiny_STL)
project(${TARGET_NAME})

if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
  set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  set(CMAKE_PROJECT_ROOT ${CMAKE_SOURCE_DIR})
  # set project output directory
   set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_PROJECT_ROOT}/bin)
   set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_PROJECT_ROOT}/lib)
   set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_PROJECT_ROOT}/lib)
   set(CMAKE_PDB_OUTPUT_DIRECTORY     ${CMAKE_PROJECT_ROOT}/pdb)
  
  # set project output directory
  if (CMAKE_CONFIGURATION_TYPES)
    foreach(OUTPUT_CONFIG ${CMAKE_CONFIGURATION_TYPES})
      string(TOUPPER ${OUTPUT_CONFIG} OUTPUT_CONFIG_UPPER)
      set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUT_CONFIG_UPPER} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
      set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUT_CONFIG_UPPER} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
      set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG_UPPER} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
      set(CMAKE_PDB_OUTPUT_DIRECTORY_${OUTPUT_CONFIG_UPPER}     ${CMAKE_PDB_OUTPUT_DIRECTORY})
    endforeach()
  elseif(CMAKE_BUILD_TYPE)
    foreach(OUTPUT_CONFIG ${CMAKE_BUILD_TYPE})
      string(TOUPPER ${OUTPUT_CONFIG} OUTPUT_CONFIG_UPPER)
      set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUT_CONFIG_UPPER} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
      set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUT_CONFIG_UPPER} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
      set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG_UPPER} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
      set(CMAKE_PDB_OUTPUT_DIRECTORY_${OUTPUT_CONFIG_UPPER}     ${CMAKE_PDB_OUTPUT_DIRECTORY})
    endforeach()
  endif ()
  
  set_property(GLOBAL PROPERTY USE_FOLDERS ON)

endif(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)



add_subdirectory(test)
